import { STUFF_TYPES } from "../../constance";
import { Handler, INPUT, OUTPUT } from '../../typings'

type ResultType = number;

type TestTemplate = <P>(instance: P) => TemplateLiteralFn

export type TemplateLiteralFn = (strs: TemplateStringsArray, ...args: ResultType[]) => void;

export const testTemplate: TestTemplate = (instance) => (strs, ...rest) => {
  const message =
    rest.map((item, index) => `${strs[index]}${item}`).join("") +
    strs.slice(rest.length).join("");

  test(message, () => {
    expect(instance.setSellIn(rest[2]).setQuality(rest[3]).tomorrow().toString()).toBe(`${rest[0]},${rest[1]}`);
  });
};
